﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;

namespace C4F.DevKit.Bluetooth.ServiceAndDeviceDiscovery
{
    /// <summary>
    /// Represents the QuerySet structure used in call to 
    /// WSALookUp* functions.
    /// </summary>
    [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)]
    public class QuerySet
    {
        /// <summary>
        /// Must be set to sizeof(WSAQuerySet).
        /// </summary>
        public int Size;
        /// <summary>
        /// Referenced string contains service name. 
        /// </summary>
        public string ServiceInstanceName;
        /// <summary>
        /// GUID corresponding to the service class.
        /// </summary>
        public IntPtr ServiceClassId;
        /// <summary>
        /// References desired version number and provides version 
        /// comparison semantics(that is, version must match exactly, 
        /// or version must be not less than the value supplied).
        /// </summary>
        public IntPtr Version;
        /// <summary>
        /// Ignored for queries.
        /// </summary>
        public string Comment;
        /// <summary>
        /// Identifier of a single namespace in which to constrain
        /// the search, or NS_ALL to include all namespaces.
        /// </summary>
        public int NameSpace;
        /// <summary>
        /// References the GUID of a specific name-space provider,
        /// and limits the query to this provider only
        /// </summary>
        public IntPtr NsProviderId;
        /// <summary>
        /// Specifies the starting point of the query in a hierarchical 
        /// namespace.
        /// </summary>
        public string Context;
        /// <summary>
        /// Size of the protocol constraint array, in bytes. Can be zero.
        /// </summary>
        public int NumberOfProtocols;
        /// <summary>
        /// References an array of AFPROTOCOLS structure.
        /// </summary>
        public IntPtr Protocols;
        /// <summary>
        /// Some namespaces (such as Whois++) support enriched SQL-like queries 
        /// that are contained in a simple text string. This parameter is used 
        /// to specify that string.
        /// </summary>
        public string QueryString;
        /// <summary>
        /// Ignored for queries.
        /// </summary>
        public int NumberOfCsAddrs;
        /// <summary>
        /// Ignored for queries.
        /// </summary>
        public IntPtr Buffer;
        /// <summary>
        /// Ignored for queries.
        /// </summary>
        public int OutputFlags;
        /// <summary>
        /// Pointer to a provider-specific entity.
        /// </summary>
        public IntPtr Blob;
    }

}
